<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue的基本代码</title>
    <style>
        [v-cloak]  {
            display: none;
        }
        .main {
            width: 125px;
        }
        button {
            display: block;
            width: 100%;
            color: #fff;
            background-color: #39f;
            border: 0;
            padding: 6px;
            text-align: center;
            font-size: 12px;
            border-radius: 4px;
            cursor: pointer;
            outline: none;
            position: relative;
        }
        button:active {
            top: 1px;
            left: 1px;
        }
        .dropdown {
            width: 100%;
            height: 150px;
            margin: 5px 0;
            font-size: 12px;
            background-color: #fff;
            border-radius: 4px;
            box-shadow: 0 1px 6px rgba(0,0,0, .2);
        }
    </style>
</head>
<body>

<div id="app" v-cloak>
    <div @keyup.esc="changeBoxShow" v-closebox="changeBoxShow" class="main">
        <button @click="show = !show">点击显示下拉菜单</button>
        <div  class="dropdown" v-show="show">
            <p>下拉框的内容，点击空白，可以关闭</p>
        </div>
    </div>
</div>


<script src="../lib/vue-2.4.0.js"></script>
<script src="closeXia.js"></script>
<script>

    var vue = new Vue({
        el: '#app',
        data: {
            show: false
        },
        methods: {
            changeBoxShow() {
                this.show = false
            }
        }
    })

</script>
</body>
</html>
